import type { Metadata } from "next"; import { getLocale } from "@/lib/i18n/server"; import { t } from "@/lib/i18n"; import { openapi } from "@/lib/papers/openapi"; export const revalidate = 3600; export async function generateMetadata(): Promise { const d = t(await getLocale()); return { title: d.api.title, alternates: { canonical: "/api/docs" } }; } export default async function ApiDocs() { const locale = await getLocale(); const d = t(locale); const spec = openapi(); return (

{d.api.title}

{spec.info.description} · openapi.json

{locale === "fr" ? "Lecture seule, sans authentification, CORS ouvert, limite de 120 requêtes par minute et par adresse. Les réponses sont en JSON ; les citations en BibTeX ou RIS." : "Read-only, no authentication, open CORS, limited to 120 requests per minute per address. Responses are JSON; citations are BibTeX or RIS."}

{Object.entries(spec.paths).map(([path, ops]) => Object.entries(ops as Record).map(([method, op]) =>

{method}{path}

{op.summary}

{op.description &&

{op.description}

}{op.parameters?.length ?
    {op.parameters.map((p) =>
  • {p.name} ({p.in}{p.schema?.type ? `, ${p.schema.type}` : ""}{p.schema?.enum ? `: ${p.schema.enum.join(" | ")}` : ""}){p.description ? ` — ${p.description}` : ""}
  • )}
: null}
))}

OAI-PMH

/api/oai?verb=Identify · ?verb=ListRecords&metadataPrefix=oai_dc · ?verb=GetRecord&identifier=oai:wp.spboucher.ai:wp38&metadataPrefix=oai_dc · ?verb=ListSets

); }